extern crate druid;
mod app;
mod mtree;

use druid::widget::{Align, Button, Flex, Label, Split};
use druid::{AppLauncher, Data, UnitPoint, Widget, WidgetExt, WindowDesc};
use keepasst_core::camphor::Camphor;

use tracing::{debug, error, warn};

use app::AppState;
use mtree::MTree;


fn main() {
    let app_state = AppState::new();
    let main_window = WindowDesc::new(ui_builder());
    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(app_state)
        .unwrap();
}

fn ui_builder() -> impl Widget<AppState> {
    let mtree = MTree::new().lens(AppState::group).debug_paint_layout();
    Split::columns(
        Align::vertical(
            UnitPoint::TOP_LEFT,
            mtree,
        ),
        Align::left(Label::new("Split B")),
    )
    .draggable(true)
    .split_point(0.2).debug_paint_layout()
}
